﻿#ifndef TCPCLIENT_H
#define TCPCLIENT_H

#include <QObject>
#include <QTcpSocket>
#include <QHostAddress>
#include <QDebug>
#include <QTimer>

class TCPClient : QObject
{
	Q_OBJECT
public:
	TCPClient();

	void InitSocket(QString serverIP, int port);//初始化Socket套接字

	void InitTimer();//初始化定时器，定时发送

	void ConnectToServer();//连接服务器  

	void SendData(QByteArray _data);//发送数据

private:
	QTcpSocket* mTcpSocket;//Tcp连接套接字
	QHostAddress mServerAddress;//服务器IP
	QTimer* mTimer;//定时器对象

};

#endif // TCPCLIENT_H

